package factory.factorymethod;

/**
 * @ProjectName: interview
 * @Package: factory.factorymethod
 * @ClassName: Operation
 * @Author: chenmengqi
 * @Description:
 * @Date: 2020/2/13 9:41 下午
 * @Version: 1.0
 */
public abstract class Operation {
    private double numberA = 0;
    private double numberB = 0;

    public double getNumberA() {
        return numberA;
    }

    public void setNumberA(double numberA) {
        this.numberA = numberA;
    }

    public double getNumberB() {
        return numberB;
    }

    public void setNumberB(double numberB) {
        this.numberB = numberB;
    }

    public abstract double getResult();
}

class OperateAdd extends Operation {
    @Override
    public double getResult() {
        return super.getNumberA() + super.getNumberB();
    }
}


class OperateSub extends Operation {
    @Override
    public double getResult() {
        return super.getNumberA() - super.getNumberB();
    }
}

class OperateMul extends Operation {
    @Override
    public double getResult() {
        return super.getNumberA() * super.getNumberB();
    }
}


class OperateDiv extends Operation {
    @Override
    public double getResult() {
        return super.getNumberA() / super.getNumberB();
    }
}
